using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using MimeCloud.AssetManagement.Editor.Config;

namespace MimeCloud.AssetManagement.ProviderServices.Config
{
    [ConfigurationCollection(typeof(RepositoryDetailCollection), AddItemName = "repositoryManager")]
    public class RepositoryDetailCollection : ConfigurationElementCollection
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new RepositoryDetail();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((RepositoryDetail) element).Name;
        }

        [ConfigurationProperty("defaultRepositoryName",  IsRequired = true)]
        public string DefaultRespositoryName
        {
            get
            {
                return (string)this["defaultRepositoryName"];
            }
        }

        [ConfigurationProperty("mimeTypeRepositories", IsRequired = true)]
        public KeyValueConfigurationCollection MimeTypeRepositories
        {
            get { return (KeyValueConfigurationCollection)(this["mimeTypeRepositories"]); }
        }
    }
}